﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using MySql.Data.MySqlClient;

namespace WaveMaster.Holidays.Club.Domain
{
    public class CheckIn
    {
        public long m_bookingID;
        public DateTime m_bookingDate;
        public DateTime m_departureDate;
        public DateTime m_returnDate;
        public string m_bookingCode;
        public string m_groupName;
        public decimal m_bookNumber;
        public decimal m_lastBalance;
        public Trip m_trip;
        public Trip m_returntrip;//reenable
        public string m_remark;
        public DateTime m_cretnDate;
        public DateTime m_modfctnDate;
        public long m_cretnBy;
        public long m_modfctnBy;
        public TravelAgent m_travelAgent;
        public TicketType m_ticketType;
        public CheckInStatus m_bookingStatus = CheckInStatus.CheckIn;

        public CheckIn BookingHistory;

        public IList m_passengerList = new ArrayList();

        public CheckIn() { }
        public CheckIn(long id) { m_bookingID = id; }
        public CheckIn(MySqlDataReader rd)
        {
            m_bookingID = Convert.ToInt64(rd["m_bookingID"]);
            m_bookingDate = Convert.ToDateTime(rd["m_bookingDate"]);
            m_bookingCode = rd["m_bookingCode"].ToString();
            m_groupName = rd["m_groupName"].ToString();
            m_ticketType = (TicketType)Enum.Parse(typeof(TicketType), rd["m_ticketType"].ToString());
            m_bookingStatus = (CheckInStatus)Enum.Parse(typeof(CheckInStatus), rd["m_bookingStatus"].ToString());
            m_bookNumber = Convert.ToDecimal(rd["m_bookNumber"]);
            m_lastBalance = Convert.ToDecimal(rd["m_lastBalance"]);
            m_trip = new Trip(Convert.ToInt64(rd["m_tripID"]));
            m_returntrip = rd["m_returntrip"] is DBNull ? null : new Trip(Convert.ToInt64(rd["m_returntrip"]));
            m_remark = rd["m_remark"].ToString();
            m_travelAgent = new TravelAgent(Convert.ToInt64(rd["m_travelAgentId"]));
            m_departureDate = Convert.ToDateTime(rd["m_departureDate"]);
            m_returnDate = Convert.ToDateTime(rd["m_returnDate"]);
            m_cretnDate = Convert.ToDateTime(rd["m_cretnDate"]);
            m_cretnBy = Convert.ToInt64(rd["m_cretnBy"]);
            m_modfctnDate = Convert.ToDateTime(rd["m_modfctnDate"]);
            m_modfctnBy = Convert.ToInt64(rd["m_modfctnBy"]);
        }

    }
}
